package com.ydc.ln.tutorial.gui;

import java.awt.Color;
import java.awt.Frame;
import java.awt.Panel;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

/**
 * 
 * @author ydc
 * @date 上午1:58:51 2013-5-18
 */
public class MyFrame extends Frame {

    /**
     * @Fields serialVersionUID
     */
    private static final long serialVersionUID = 1433921813259071765L;

    int fWidth = 1024;
    int fHeight = 600;
    int pWidth = 1024;
    int pHeight = 600;
    int loX = 10;
    int loY = 30;

    public MyFrame() {
        super();
        this.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });

        setSize(pWidth, pHeight);
        setBackground(Color.WHITE);
        setLocation(80, 80);
        setLayout(null);
        setVisible(true);
        // pack();
    }

    public Panel getPanel() {

        Panel p = new Panel();
        p.setSize(pWidth, pHeight);
        p.setBackground(Color.CYAN);
        p.setLocation(loX, loY);
        return p;
    }

    public void addPanel(Panel p) {
        add(p);
    }
}
